/**
 * @param {number} rowIndex
 * @return {number[]}
 */
var getRow = function(rowIndex) {
	if (rowIndex<0) {return [];}
    let result = [1];
    let cur = 1;
    while(cur<=rowIndex){
    	result.push(1);
    	for(let i=cur-1;i>0;i--){
    		result[i] = result[i]+result[i-1];
    	}
    	cur++;
    }
    return result;
};

console.log(getRow(1));